package org.example;
import javax.swing.*;
import java.awt.*;

public class MainFrame extends JFrame {

    private Container contentP; //内容面板
    private Panel_1 panel1;//上半部分
    private Panel_2 panel2;//按钮部分
    private Panel_3 panel3;//中间部分
    private Panel_4 panel4;//下半部分

    public MainFrame() {
        Toolkit tk = Toolkit.getDefaultToolkit();
        Image img = tk.getImage("/Users/cengyunke/Desktop/atm1/QQGUIWork/src/main/java/org/example/img/logo.gif");
        this.setIconImage(img);
        this.setSize(320, 240);
        this.setLocationRelativeTo(null);
        this.setTitle("QQ200X");
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.addContent();
        this.setResizable(false);//设置窗体大小不可变

        this.setVisible(true);
    }

    private void addContent() {
        this.contentP = this.getContentPane();
        this.contentP.setLayout(null);

        this.panel1 = new Panel_1();//上半部分
        this.panel1.setBounds(0, 0, 320, 170);
        this.contentP.add(this.panel1);

        this.panel2 = new Panel_2(this);//上半部分
        this.panel2.setBounds(0, 170, 320, 50);
        this.panel2.setBackground(new Color(225, 249, 254));
        this.contentP.add(this.panel2);

        this.panel3 = new Panel_3();//中间部分
        this.panel3.setBounds(0, 220, 320, 85);
        this.panel3.setBackground(new Color(225, 249, 254));
        this.contentP.add(this.panel3);

        this.panel4 = new Panel_4();//下半部分
        this.panel4.setBounds(0, 305, 320, 240);
        this.panel4.setBackground(new Color(225, 249, 254));
        this.contentP.add(this.panel4);
    }
}
